﻿using System;
using System.ComponentModel;
using System.Configuration;

namespace mki.Backup.Objects
{
	/// <summary>
	/// Represents the ConfigurationElement class and hides unwanted properties from property grid
	/// </summary>
	public class CustomConfigurationElement : ConfigurationElement, INotifyPropertyChanged
	{
		#region Delegates and Events (1)

		// Events (1) 

		// Public Events (1) 

		/// <summary>
		/// Occurs when a property value changes.
		/// </summary>
		public event PropertyChangedEventHandler PropertyChanged;

		#endregion Delegates and Events

		#region Properties (8)

		// Public Properties (8) 

		[Browsable(false)]
		public new Configuration CurrentConfiguration { get { return base.CurrentConfiguration; } }

		[Browsable(false)]
		public new ElementInformation ElementInformation { get { return base.ElementInformation; } }

		[Browsable(false)]
		public new ConfigurationLockCollection LockAllAttributesExcept { get { return base.LockAllAttributesExcept; } }

		[Browsable(false)]
		public new ConfigurationLockCollection LockAllElementsExcept { get { return base.LockAllElementsExcept; } }

		[Browsable(false)]
		public new ConfigurationLockCollection LockAttributes { get { return base.LockAttributes; } }

		[Browsable(false)]
		public new ConfigurationLockCollection LockElements { get { return base.LockElements; } }

		[Browsable(false)]
		public new bool LockItem { get { return base.LockItem; } set { base.LockItem = value; } }

		[ConfigurationProperty("name", IsRequired = true, IsKey = true)]
		[Description("Name of the element"), Category("Design")]
		public String Name
		{
			get { return this["name"].ToString(); }
			set { this["name"] = value; }
		}

		#endregion Properties

		#region Methods (1)

		// Protected Methods (1) 

		/// <summary>
		/// Called when [property changed].
		/// </summary>
		/// <param name="propertyName">Name of the property.</param>
		protected virtual void OnPropertyChanged(String propertyName)
		{
			if (this.PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); }
		}

		#endregion Methods
	}
}